package com.share.rule.api;

import com.share.common.core.domain.R;
import com.share.rule.service.IFeeRuleService;
import com.share.rules.api.domain.FeeRule;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/feeRule")
@SuppressWarnings({"unchecked", "rawtypes"})
public class FeeRuleApiController {

   @Autowired
   private IFeeRuleService feeRuleService;

   @Operation(summary = "批量获取费用规则信息")
   @PostMapping(value = "/getFeeRuleList")
   public R<List<FeeRule>> getFeeRuleList(@RequestBody List<Long> feeRuleIdList)
   {
      return R.ok(feeRuleService.listByIds(feeRuleIdList));
   }

   @Operation(summary = "获取费用规则详细信息")
   @PostMapping(value = "/getFeeRule/{id}")
   public R<FeeRule> getFeeRule(@PathVariable("id") Long id)
   {
      return R.ok(feeRuleService.getById(id));
   }

}